package com.neusoft.mapper;

import com.neusoft.po.RedemptionRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RedemptionRecordMapper {

    // 插入一条兑换记录
    @Insert("INSERT INTO RedemptionRecord(userId, productId, productName, pointCost, redemptionDate) VALUES(#{userId}, #{productId}, #{productName}, #{pointCost}, #{redemptionDate})")
    void insertRedemptionRecord(RedemptionRecord record);

    // 根据 userId 查询兑换记录
    @Select("SELECT * FROM RedemptionRecord WHERE userId = #{userId}")
    List<RedemptionRecord> getRedemptionRecordsByUserId(String userId);
}